package com.novax.ex.activity.open.api.inner;

import com.novax.ex.activity.open.model.request.RankRuleRequest;
import com.novax.ex.activity.open.model.request.RankSubRuleRequest;
import com.novax.ex.activity.open.model.response.RankRuleResponse;
import com.novax.ex.common.results.ReturnResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import jakarta.validation.Valid;
import java.util.List;

/**
 * description: 排名赛规则配置
 *
 * @author shaw
 * @date 11/30/22 11:14
 */
@Tag(name = "排名赛规则配置", description = "排名赛规则配置")
@FeignClient(url = "${remote.activity-service.endpoint}", name = "RankRuleInnerApi", contextId = "RankRuleInnerApi")
public interface RankRuleInnerApi {

    // 主活动规则配置
    @Operation(summary = "主活动查询活动配置的规则")
    @GetMapping(value = "/v3/private/rank/rules/{rankId}")
    ReturnResult<List<RankRuleResponse>> ruleList(@PathVariable Long rankId);

    @Operation(summary = "主活动新增")
    @PostMapping("/v3/private/rank/rules")
    ReturnResult<?> add(@RequestHeader("language") String language,
                        @Valid @RequestBody RankRuleRequest ruleRequest,
                        BindingResult bindingResult);

    @Operation(summary = "主活动修改")
    @PostMapping(value = "/v3/private/rank/rules/{id}")
    ReturnResult<?> modify(@RequestHeader("language") String language,
                           @PathVariable Long id,
                           @RequestBody RankRuleRequest ruleRequest);

    // 子活动规则配置
    @Operation(summary = "子活动查询活动配置的规则")
    @GetMapping(value = "/v3/private/rank-sub/rules/{rankSubId}")
    ReturnResult<List<RankRuleResponse>> subRuleList(@PathVariable Long rankSubId);

    @Operation(summary = "子活动新增")
    @PostMapping("/v3/private/rank-sub/rules")
    ReturnResult<?> subAdd(@RequestHeader("language") String language,
                           @Valid @RequestBody RankSubRuleRequest ruleRequest,
                           BindingResult bindingResult);

    @Operation(summary = "子活动修改")
    @PostMapping(value = "/v3/private/rank-sub/rules/{id}")
    ReturnResult<?> subModify(@RequestHeader("language") String language,
                              @PathVariable Long id,
                              @RequestBody RankSubRuleRequest ruleRequest);

}